package com.lmh.friend.controller.exam;

import com.lmh.common.core.controller.BaseController;
import com.lmh.common.core.domain.R;
import com.lmh.common.core.domain.TableDataInfo;
import com.lmh.friend.domain.exam.dto.ExamQueryDTO;
import com.lmh.friend.domain.exam.dto.ExamRankDTO;
import com.lmh.friend.domain.exam.vo.ExamRankVO;
import com.lmh.friend.service.exam.IExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/exam")
@RestController
public class ExamController extends BaseController {
    @Autowired
    private IExamService examService;

    @GetMapping("/semiLogin/list")
    public TableDataInfo list(ExamQueryDTO examQueryDTO) {
        return getTableDataInfo(examService.list(examQueryDTO));
    }

    @GetMapping("/semiLogin/redis/list")
    public TableDataInfo redisList(ExamQueryDTO examQueryDTO) {
        return examService.redisList(examQueryDTO);
    }

    @GetMapping("/getExamFirstQuestion")
    public R<String> getExamFirstQuestion(Long examId) {
        return R.ok(examService.getExamFirstQuestion(examId));
    }

    @GetMapping("/preQuestion")
    public R<String> preQuestion(Long examId, Long questionId) {
        return R.ok(examService.preQuestion(examId, questionId));
    }

    @GetMapping("/nextQuestion")
    public R<String> nextQuestion(Long examId, Long questionId) {
        return R.ok(examService.nextQuestion(examId, questionId));
    }

    @GetMapping("/rank/list")
    public TableDataInfo examRankList(ExamRankDTO examRankDTO) {
        return examService.examRankList(examRankDTO);
    }
}
